<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><!--JBuilder QuickDoc-->
<HEAD>
<TITLE>Class BLUElet</TITLE><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
</HEAD>
<BODY>

<H2>
<FONT SIZE="-1"></FONT>
<BR>Class BLUElet</H2>
<DL>
<DT>public class <B>BLUElet</B><DT>implements javax.microedition.lcdui.CommandListener
</DL>
<DL><DD><p>Title: Bluetooth Application Utility GUI Component</p> <p>Description: Note: This class must be used as singleton. </p><DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Version:</B><DD>1.0 LICENSE: This code is licensed under GPL. (See http://www.gnu.org/copyleft/gpl.html)</DD>
<DT><B>Author:</B><DD>Ben Hui (www.benhui.net)A</DD>
</DL>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF"><TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B>
</FONT></TD></TR></TABLE>

<A NAME="BLUElet(javax.microedition.midlet.MIDlet, javax.microedition.lcdui.CommandListener)"></A>

<H3>BLUElet</H3>
<PRE>
public <B>BLUElet</B>(javax.microedition.midlet.MIDlet&nbsp;host,
               javax.microedition.lcdui.CommandListener&nbsp;listener)</PRE>
<DL><DD>Creae a new BLUElet.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>host</CODE> - MIDlet</DD>
<DD><CODE>listener</CODE> - CommandListener</DD>
</DL>
<HR>

<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF"><TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B>
</FONT></TD></TR></TABLE>

<A NAME="startApp()"></A>

<H3>startApp</H3>
<PRE>
public void <B>startApp</B>()</PRE>
<DL><DD>Mirror MIDlet.startApp(), should be called by your MIDlet startApp().<DL><DD></DD></DL></DD>
</DL>
<DL></DL>
<HR>

<A NAME="pauseApp()"></A>

<H3>pauseApp</H3>
<PRE>
public void <B>pauseApp</B>()</PRE>
<DL><DD>Mirror MIDlet.pauseApp(), should be called by your MIDlet pauseApp().<DL><DD></DD></DL></DD>
</DL>
<DL></DL>
<HR>

<A NAME="destroyApp(boolean)"></A>

<H3>destroyApp</H3>
<PRE>
public void <B>destroyApp</B>(boolean&nbsp;unconditional)</PRE>
<DL><DD>Mirror MIDlet.destroyApp(), should be called by your MIDlet destroyApp().<DL><DD></DD></DL></DD>
</DL>
<DL></DL>
<HR>

<A NAME="log(java.lang.String)"></A>

<H3>log</H3>
<PRE>
public static void <B>log</B>(java.lang.String&nbsp;s)</PRE>
<DL><DD>Utility function to write log message.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>s</CODE> - String</DD>
</DL>
<HR>

<A NAME="getUI()"></A>

<H3>getUI</H3>
<PRE>
public javax.microedition.lcdui.Screen <B>getUI</B>()</PRE>
<DL><DD>Obtain reference to device selection screen component. You should show this screen when user invoke device search.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Returns:</B><DD>Screen</DD>
</DL>
<HR>

<A NAME="getDiscoveredServices()"></A>

<H3>getDiscoveredServices</H3>
<PRE>
public javax.bluetooth.ServiceRecord[] <B>getDiscoveredServices</B>()</PRE>
<DL><DD>Get all discovered services from selected remote device. Your application call this method after your app receive COMPLETED callback event. This will return all services that match your UUIDs in startInquiry().<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Returns:</B><DD>ServiceRecord[]</DD>
</DL>
<HR>

<A NAME="getFirstDiscoveredService()"></A>

<H3>getFirstDiscoveredService</H3>
<PRE>
public javax.bluetooth.ServiceRecord <B>getFirstDiscoveredService</B>()</PRE>
<DL><DD>Get the first discovered service from selected remote device. Your application call this method after your app receives COMPLETED callback event. This will return the first service that match your UUIDs in startInquiry().<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Returns:</B><DD>ServiceRecord null if no service discovered</DD>
</DL>
<HR>

<A NAME="getDeviceDiscoveryReturnCode()"></A>

<H3>getDeviceDiscoveryReturnCode</H3>
<PRE>
public int <B>getDeviceDiscoveryReturnCode</B>()</PRE>
<DL><DD>Return the Bluetooth result code from device inquiry. This is the result code obtained in DiscoveryListener.inquiryCompleted(). Your application cal call this method after a COMPLETED callback event is received.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Returns:</B><DD>int</DD>
</DL>
<HR>

<A NAME="getServiceDiscoveryReturnCode()"></A>

<H3>getServiceDiscoveryReturnCode</H3>
<PRE>
public int <B>getServiceDiscoveryReturnCode</B>()</PRE>
<DL><DD>Return the Bluetooth result code from service discovery. This is the result code obtained in DiscoveryListener.serviceSearchCompleted(). Your application cal call this method after a COMPLETED callback event is received.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Returns:</B><DD>int</DD>
</DL>
<HR>

<A NAME="getSelectedDevice()"></A>

<H3>getSelectedDevice</H3>
<PRE>
public javax.bluetooth.RemoteDevice <B>getSelectedDevice</B>()</PRE>
<DL><DD>Return user selected remote device that is used for service discovery. Your application can call this after your app received SELECTED callback event.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Returns:</B><DD>RemoteDevice null if user didn't select anything</DD>
</DL>
<HR>

<A NAME="startInquiry(int, javax.bluetooth.UUID[])"></A>

<H3>startInquiry</H3>
<PRE>
public void <B>startInquiry</B>(int&nbsp;mode,
                         javax.bluetooth.UUID[]&nbsp;serviceUUIDs)</PRE>
<DL><DD>Start device inquiry. Your application call this method to start inquiry.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>mode</CODE> - int one of DiscoveryAgent.GIAC or DiscoveryAgent.LIAC</DD>
<DD><CODE>serviceUUIDs</CODE> - UUID[]</DD>
</DL>
<HR>

<A NAME="commandAction(javax.microedition.lcdui.Command, javax.microedition.lcdui.Displayable)"></A>

<H3>commandAction</H3>
<PRE>
public void <B>commandAction</B>(javax.microedition.lcdui.Command&nbsp;c,
                          javax.microedition.lcdui.Displayable&nbsp;d)</PRE>
<DL><DD><DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>c</CODE> - Command</DD>
<DD><CODE>d</CODE> - Displayable</DD>
</DL>
<HR>

</BODY>
</HTML>